function dashboard(options_in) {
	var dash_board = this;
	
	var options = $.extend(
			true
			, {}
			, {
				  parent		: null
				, panel_count	: 3
				, orientation	: "vertical"
				, items			: null //ARRAY OF DASH ITEMS
				, project		: null //{id:"1", name:"test", start_on:"",finish_on:"", group_id:""}
			  }
			, options_in);
	options.parent = "#"+options.parent;
	options.items = options_in.items;
	
	//console.log("dashboard item count: "+ options.items.length);
	
	dash_board.refresh = refresh;
	dash_board.create = create;
	dash_board.clear = clear;
	
	function clear(){
		$(options.items).each(function(){
			var item_obj = this;
			var panel = $(options.parent).find("#"+item_obj.id);

			panel.find("div").each(function(){
				if ($(this).hasClass("widget-content")){
					$(this).children().remove();
				}
			});
		});
	}
	
	function __create_widget(item_obj){
		var widget = $("<div id='"+item_obj.id+"' class='dash-widget ui-widget ui-corner-all ui-widget-header'>" +
							"<div style='height:20px;' class='widget-header ui-corner-top'></div>" +
							"<div id='content-"+item_obj.id+"' class='widget-content ui-widget'></div>" +
						"</div>");
		widget.css(
				{
					  "width": item_obj.width
					, "height": item_obj.height
					, "border": "1px solid lightgrey"
				}
			);

		widget.find("div").each(function(){
			if ($(this).hasClass("widget-header")){
				$(this).append($("<div style='width:90%;overflow:clip;float:left;text-align:center;font-size:14px;'><b>"+item_obj.title+"</b></div>"));
				//$(this).append(span);
			}
			
			if ($(this).hasClass("widget-content") && item_obj.content != null){
				$(this).append($(item_obj.content));
			}
		});
		
		widget.prop("dash_widget", item_obj);
		
		return widget;
	}

	function refresh(options_in){
		if (options_in){
			options = $.extend(true, {}, options, options_in);
			//ONLY OVER WRITE DATA IF NEW IS PASSED IN
			if (options_in.data) options.data = options_in.data;
			if (options_in.project) options.project = options_in.project;
		}
		$(options.items).each(function(){
			var item_obj = this;
			var panel = $(options.parent).find("#"+item_obj.id);

			panel.find("div").each(function(){
				if ($(this).hasClass("widget-content")){
					if (item_obj.content_function != null){
						var obj = item_obj.content_function(this, options);
						if (obj && obj != null){
							$(this).children().remove();
							$(this).append(obj);
						}
					}
				}
			});
		});
	}

	function create(){
		//FIRST CLEAR THE AREA OF ALL EXISTING WIDGETS
		$(options.parent).children().remove();
		
		//dashboard_options = options;
		
		for(var i = 0; i < options.panel_count; i++){
			var div = $("<div id='dash_panel_num_"+ (i+1) +"'></div");
			
			if (options.orientation == "vertical"){
				div.css("float", "left");
			}
			div.css({"padding" : "5px"});
			$(options.parent).append(div);
		}
		
		$(options.items).each(function(){
			var panel = $(options.parent).find("#dash_panel_num_" + this.attach_to_panel);

			var w = __create_widget(this);
			if (options.orientation != "vertical"){
				w.css("float", "left");
			}
			
			panel.append(w);
			panel.append("<br/>");
		});

		for(var i = 0; i < options.panel_count; i++){
			var div = $("<div id='dash_panel_num_"+ (i+1) +"'></div");
			
			var h = parseFloat(div.css("height"));
			var w = parseFloat(div.css("width"));
			
		}
		if (options.orientation == "vertical"){
			//NEED TO MAKE SURE THAT THE WIDGET REMAIN NEXT TO EACH OTHER AND DOES NOT WRAP
			var container_width = 0;
			for(var i = 0; i < options.panel_count; i++){
				var div = $("#dash_panel_num_"+ (i+1));
				var w = -1;
				div.find("div").each(function(){
					if ($(this).width() > w) w = $(this).width();
				});
				
				if (w > 0) container_width += w;
			}
			//console.log("sprint dashboard width: "+container_width);
			$(options.parent).css("width", container_width+50);
		}

		dash_board.refresh();
	}
}
